<?php

namespace polymerize\media\module\banner;

use app\common\InstanceTrait;
use app\model\Banner;

class GetBannerList
{
    use InstanceTrait;

    /**
     * 轮播图列表
     *
     * @param int    $uid
     * @param int    $page
     * @param int    $limit
     * @return array
     */
    public function getBannerList(int $uid, int $page, int $limit): array
    {
        $where[] = ['status', '=', 1];

        $list = Banner::field('*')
            ->where($where)
            ->page($page, $limit)
            ->order('sort asc');

        $list = $list->select()->toArray();

        return $list;
    }
}
